package cn.edu.usst.cs.goldfish.booking.meetingroom.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

@Data
public class MeetingSlot {
    @TableId(type = IdType.AUTO)
    private Long id;
    private Long meetingId;
    private LocalDate date;
    private Short hour;
    private Short part; // 1~6，每片 10 分钟
    @JsonIgnore
    public LocalDateTime getTime(){
        int minute = (part - 1) * 10;
        LocalTime  time = LocalTime.of(hour, minute);
        return LocalDateTime.of(date, time);
    }
}